import json

# 把Python数据类型转换为JSON字符串
person_list = [{'name': '张国庆', 'age': 6, 'money': '1200万'},
               {'name': 'Jagochan', 'age': 7, 'money': '1000万'},
               {'name': '刘狗蛋', 'age': 8, 'money': '100万'}]
persons_json = json.dumps(person_list, ensure_ascii=False)
print(persons_json)
print(type(persons_json))
print('🍀')

person = {'name': 'Jagochan', 'age': 12, 'money': '1000万'}
person_json = json.dumps(person, ensure_ascii=False)
print(person_json)
print(type(person_json))
print('🍀')

# 把JSON字符串转换为Python数据类型
persons_json = '[{"name": "张国庆666", "age": 6, "money": "1200万"}, {"name": "Jagochan666", "age": 7, "money": "1000万"}, ' \
               '{"name": "刘狗蛋", "age": 8, "money": "100万"}] '
person_list = json.loads(persons_json)
print(person_list)
print(type(person_list))
print('🍀')

person_json = '{"name": "Jagochan888", "age": 12, "money": "1088800万"}'
person_dict = json.loads(person_json)
print(person_dict)
print(type(person_dict))
